{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "2faa616d-f250-4ae8-84c3-f92715aefbf7",
   "metadata": {},
   "outputs": [],
   "source": [
    "from elasticsearch import Elasticsearch\n",
    "from getpass import getpass\n",
    "\n",
    "ELASTIC_CLOUD_ID = getpass(\"Elastic Cloud ID: \")\n",
    "ELASTIC_API_KEY = getpass(\"Elastic Api Key: \")\n",
    "\n",
    "client = Elasticsearch(\n",
    "    cloud_id=ELASTIC_CLOUD_ID,\n",
    "    api_key=ELASTIC_API_KEY,\n",
    ")\n",
    "\n",
    "# delete the notebook's index\n",
    "client.indices.delete(index=\"approx-search-demo\", ignore_unavailable=True)\n",
    "\n",
    "# delete the pipeline\n",
    "try:\n",
    "    client.ingest.delete_pipeline(id=\"vectorize_workplace\")\n",
    "except:\n",
    "    pass\n",
    "\n",
    "# delete the model\n",
    "try:\n",
    "    client.ml.delete_trained_model(\n",
    "        model_id=\"sentence-transformers__all-minilm-l6-v2\", force=True\n",
    "    )\n",
    "except:\n",
    "    pass"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.11.6"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
